arc != uname -m | grep -e x86_64 -e amd64 | wc -c
.if( $(arc) != 0 )
.error invalid architecture
.endif

LD  = gfortran
FC  = gfortran
LIB     = ./lib
LFLAGS = -lanam
FFLAGS = -pipe -fsecond-underscore -x f95 \
	-c -Wall -std=gnu -Wno-conversion -fno-range-check \
	-I$(LIB) \
	-fbackslash
AFLAGS = -f elf
LDFLAGS = 
MAKE = make
MAKEFLAGS =
#
.ifdef _DEBUG_
FFLAG += -g
.else
FFLAG += -s -fomit-frame-pointer -O3
.endif

#
.ifdef _LINUX_ 
AFLAGS += -D_LINUX_
.endif

#
LDEP = $(LIB)/libanam.a

.PHONY: clean all

.SUFFIXES:
.SUFFIXES: .o .f90

all: faely

.f90.o:
	$(FC) $(FFLAGS) $<

$(LDEP):
	cd $(LIB) && $(MAKE)

tmp.f90: main.f90
	./puttime main.f90 tmp.f90

tmp.o: tmp.f90

faely: $(LDEP) tmp.o
	$(LD) $(LDFLAGS) tmp.o $(LDEP) -o faely

clean:
	\rm -f *.o *.*~ *.core *.mod tmp.f90 faely
	cd $(LIB) && $(MAKE) clean